package sk.kainitram.fuel;

import sk.kainitram.fuel.model.eFuelType;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

/**
 * @author Mino develop
 *
 */
public class NewFuel extends Activity {

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        
        
		setContentView(R.layout.newfuel);	
		
		ActionBar actionBar = getActionBar();
	    actionBar.setDisplayHomeAsUpEnabled(true);
    }
	
	
	public boolean onOptionsItemSelected(MenuItem item) {
	    switch (item.getItemId()) {
	        case android.R.id.home:
	            cancel();
	            return true;
	        default:
	            return super.onOptionsItemSelected(item);
	    }
	}	
		
	public void btnOk_OnClick(View view)
	{
		Intent data = new Intent();
		if (getParent() == null) {
		    setResult(Activity.RESULT_OK, data);
		} else {
		    getParent().setResult(Activity.RESULT_OK, data);
		}
		
		finish();
	}
		
	public void btnCancel_OnClick(View view)
	{
		cancel();
	}
		
	private void cancel()
	{
		Intent data = new Intent();
		if (getParent() == null) {
		    setResult(Activity.RESULT_CANCELED, data);
		} else {
		    getParent().setResult(Activity.RESULT_CANCELED, data);
		}
		
		finish();
	}
}
